package gui;

/**
 *
 * @author Jaime Renato Castorela Castro
 */
public class FuncionalidadMenuCartelera {
    final int CERO = 0;
    private int inicial;
    private int terminal;
    private int actual;
    private int visibles;

    public FuncionalidadMenuCartelera(int inicial, int terminal, int actual, int visibles) {
        this.inicial = inicial;
        this.terminal = terminal;
        this.actual = actual;
        this.visibles = visibles;
    }
   
    public int getVisibles() {
        return visibles;
    }

    public void setVisibles(int visibles) {
        this.visibles = visibles;
    }
    public int getFinal(){
        if(inicial + visibles - 1 >= terminal){
            return terminal;
        }
        return inicial + visibles -1;
    }


    public int getActual() {
        return actual;
    }

    public void setActual(int actual) {
        this.actual = actual;
    }

    public int getInicial() {
        return inicial;
    }

    public void setInicial(int inicial) {
        this.inicial = inicial;
    }

    public int getTerminal() {
        return terminal;
    }

    public void setTerminal(int terminal) {
        this.terminal = terminal;
    }
    public void subir(){
        if(actual == inicial){
            return;
        }
        if( (actual -1) <= inicial  && inicial - 1 >= 0 ){


            inicial--;
            actual--;
        }else{
            actual--;
        }
    }
    public void bajar(){
        if(actual == terminal){
            return;
        }
        if( (actual + 1) > (getFinal() ) ){
            inicial++;
            actual++;
            return;
        }else{
            actual++;
        }

    }
    public boolean hayAnterior(){
        if(inicial - 1 >= CERO ){
            return true;
        }else{
            return false;
        }
    }
    public boolean haySiguiente(){
        if( getFinal()  >= terminal ){
            return false;
        } else{
            return true;
        }

    }
}
